# from django.urls import path, include, re_path
#
# from user import views
#
# app_name = 'user'
# urlpatterns = [
#     # # 使用  FBV（Function-Based Views，基于函数的视图） 模式来处理请求
#     # path('list', views.user_list, name='list'),
#     # path('detail/<int:pk>', views.user_detail, name='detail'),
#     # path('add', views.user_add, name='add'),
#     # path('modify/<int:pk>', views.user_modify, name='modify'),
#     # path('delete/<int:pk>', views.user_delete, name='delete'),
#     # path('query/<int:pk>', views.user_query, name='query'),
#     # path('queryall', views.user_queryall, name='queryall'),
#     #
#     # path('address-add', views.address_add, name='address-add'),
#     # re_path(r'address-modify/(?P<pk>\d+)', views.address_modify, name='address-modify'),
#     # path('address-list', views.address_list, name='address-list'),
#     # path('address-delete/<int:pk>', views.address_delete, name='address-delete')
#
#     # 使用 CBV（Class-Based Views，基于类的视图） 模式 来处理请求判断
#     # path('user', views.UserView.as_view(), name='user-list'),
#     # path('user/<int:pk>', views.UserView.as_view(), name='user-detail'),
#     # path('address', views.AddressView.as_view(), name='address-list'),
#     # path('address/<int:pk>', views.AddressView.as_view(), name='address-detail'),
#
#     # 3.第三版本：使用 CBV（Class-Based Views，基于类的视图） 来处理请求判断
#     # path('user', views.UserView.as_view({"get": "list", "post": "create"}), name='user-list'),
#     # path('user/<int:pk>', views.UserView.as_view({"get": "retrieve", "put": "update", "delete": "destroy"}),
#     #      name='user-detail'),
#     # path('address', views.AddressView.as_view({"get": "list", "post": "create"}), name='address-list'),
#     # path('address/<int:pk>', views.AddressView.as_view({"get": "retrieve", "put": "update", "delete": "destroy"}),
#     #      name='address-detail'),
#
# ]


# # 路由第二版本
# from rest_framework.routers import DefaultRouter
# from user import views
#
# # 创建一个 路由管理对象
# # trailing_slash 是否以 / 结尾，默认是 True（建议不添加）
# router = DefaultRouter(trailing_slash=False)
#
# # 使用路由管理对象，注册视图集 ViewSet
# # basename 起个别名
# router.register('user', views.UserView, basename='user')
# router.register('address', views.AddressView, basename='address')

from rest_framework.routers import SimpleRouter
from user import views

router = SimpleRouter(trailing_slash=False)
router.register('user', views.UserViewSet, basename='user')

# 添加这行代码，将路由器的URL模式赋值给urlpatterns
urlpatterns = router.urls
